package Formular;

/**
 * Some usefull geometric calculations.
 * 
 * @author Torbjoern Klatt
 */
public class Geometry {
    /**
     * Calculating the circumference of a circle with given radius. Method
     * Constants.PI() is used.
     * 
     * @param r as Double
     * @return Double
     */
    public static double circumference(double r) {
        double u = 2 * r * Constants.PI();
        return u;
    }
    
    /**
     * Calculating the area of a circle with given radius. Method 
     * Constants.PI() is used.
     * 
     * @param r as Double
     * @return Double
     */
    public static double areaOfCircle(double r) {
        double f = ((4 * (r * r)) * Constants.PI()) / 4;
        return f;
    }
    
    /**
     * Claculating the coat of a cylinder with given radius and height. Method
     * circumference() of this class is used.
     * @param r as Double
     * @param h as Double
     * @return Double
     */
    public static double coatOfCylinder(double r, double h) {
        double m = circumference(r) * h;
        return m;
    }
    
    /**
     * Calculating the surface of a cylinder with given radius and height.
     * Methods areaOfCircle() and coatOfCylinder() of this class are used.
     * @param r as Double
     * @param h as Double
     * @return Double
     */
    public static double surfaceOfCylinder(double r, double h) {
        double o = (2 * areaOfCircle(r)) + coatOfCylinder(r,h);
        return o;
    }
    
    /**
     * Calculating the volume of a cylinder with given radius and height.
     * Method areaOfCircle() of this class is used.
     * @param r as Double
     * @param h as Double
     * @return Double
     */
    public static double volumeOfCylinder(double r, double h) {
        double v = areaOfCircle(r) * h;
        return v;
    }
}
